
 const isClient = typeof window !== 'undefined'

// 判断参数是否是其中之一
 function oneOf (value, validList) {
  for (let i = 0; i < validList.length; i++) {
      if (value === validList[i]) {
          return true;
      }
  }
  return false;
}
const on = (function() {
  if (isClient && document.addEventListener) {
      return function(element, event, handler, useCapture = false) {
          if (element && event && handler) {
              element.addEventListener(event, handler, useCapture);
          }
      };
  } else {
      return function(element, event, handler) {
          if (element && event && handler) {
              element.attachEvent('on' + event, handler);
          }
      };
  }
})();
/* istanbul ignore next */
 const off = (function() {
  if (isClient && document.removeEventListener) {
      return function(element, event, handler, useCapture = false) {
          if (element && event) {
              element.removeEventListener(event, handler, useCapture);
          }
      };
  } else {
      return function(element, event, handler) {
          if (element && event) {
              element.detachEvent('on' + event, handler);
          }
      };
  }
})();
export  {isClient, oneOf,on,off} 